# Create your tests here.

# a = (('3000',), ('3001',))
#
# b = [('3000',), ('3001',)]
#
# a_set = set(a)
# b_set = set(b)
#
# c = a_set.intersection(b_set)
#
# print(c)

# a = datetime.datetime.now()
#
# b = ''.join(str(a).split(' ')[0].split('-'))
#
# print(b)

# def readExcelDataByName(fileName,sheetName):
#
#     table=None
#
#     try:
#         data=xlrd.open_workbook(fileName)
#         table=data.sheet_by_name(sheetName)
#     except Exception as e:
#         print(e)
#
#     return table

#coding=utf-8
import xlrd

#根据列名获取相应序号
def getColumnIndex(table,columnName):
    columnIndex=None
    data_list = []
    for i in range(table.ncols):
        if(table.cell_value(0,i)==columnName):
            for j in range(table.nrows):
                data = table.cell_value(j,i)
                data_list.append(data)
    return data_list

#根据Excel中sheet名称读取数据
def readExcelDataByName(fileName,sheetName):

    table=None
    try:
        data=xlrd.open_workbook(fileName)
        table=data.sheet_by_name(sheetName)
    except Exception:
        pass

    return table

# if __name__=='__main__':
#     #example
#     xlsfile=r'/Users//Desktop/python/房源清单-(截止1031）.xlsx'
#     xlssheet='Sheet1'
#     table=readExcelDataByName(xlsfile,xlssheet)
#     #获取第一行的值
#     chanpinleixing=table.cell_value(1,getColumnIndex(table,'产品类型'))
#     fangyuanmingcheng=table.cell_value(1,getColumnIndex(table,'房源名称'))
#
#     print(u'产品类型为：%s'%(chanpinleixing))
#     print(u'房源名称为：%s'%(fangyuanmingcheng))